/**
 * 
 */
package com.adel.springIoc.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import com.adel.springIoc.beans.User;
import com.adel.springIoc.dao.UserDao;

/**
 * @author adruhora
 * 
 */
@Component
public class UserServiceImpl implements UserService {
	/*
	 * @Autowired will tell Spring to search for a Spring bean which implements
	 * the required interface and place it automatically into the setter.
	 */

	@Autowired
	//@Qualifier("dao")
	@Qualifier("daoImpl")
	private UserDao userDao;

	/*
	 * constructor injection
	 */
	//@Autowired
	/*public UserServiceImpl(UserDao userDao) {
		this.userDao = userDao;
	}*/


	public User getUserById(Integer id) {

		return userDao.getUserById(id);
	}

	public void addMyUserToBoard(User user) {
		userDao.saveUser(user);
	}

	public List<User> getAllUsers() {

		List<User> usersList = userDao.getUsers();
		return usersList;
	}

}
